import { inject, injectable } from "tsyringe";
import { Request, IRequest } from "./tokens";
import { ForbiddenError } from "./error";
export interface IAccount { }
@injectable()
export class Account {
    appid: string;
    appsecret: string;
    constructor(@inject(Request) req: IRequest) {
        const { appid, appsecret } = req.headers;
        if (!appid) throw new ForbiddenError(`请在headers传入appid`)
        if (!appsecret) throw new ForbiddenError(`请在headers传入appsecret`)
        this.appid = appid as string;
        this.appsecret = appsecret as string;
    }

    async fetchAccountInfo(): Promise<IAccount> {
        throw new Error(`method not implements`)
    }

    async needPermission(permission: string): Promise<boolean> {
        throw new Error(`method not implements`)
    }
}